from django.db import models

# Create your models here.

from django.contrib import admin 
from django.contrib.auth.models import User
from django.db.models.signals import post_save

class UserProfile(models.Model):
    user = models.OneToOneField(User)
    nickName = models.CharField(max_length = 30)
    authority = models.IntegerField(max_length = 2)

def create_user_profile(sender, instance, created, **kwargs):
    if created:
        UserProfile.objects.create(user=instance)

post_save.connect(create_user_profile, sender=User)

#class UserProfileAdmin(admin.ModelAdmin):
#     list_display = ('nickName',)

admin.site.register(UserProfile)
